﻿namespace Digitalmes.Application.Sys.Posts.Queries;

/// <summary>
/// 查询职位命令。
/// </summary>
public record GetPosListQuery : IRequest<IResult<List<SysPosDto>>>;

internal sealed class GetPosListQueryHandler(IRepository<SysPos> repo) : IRequestHandler<GetPosListQuery, IResult<List<SysPosDto>>>
{
    public async Task<IResult<List<SysPosDto>>> Handle(GetPosListQuery request, CancellationToken cancellationToken)
    {
        var items = await repo.GetListAsync(cancellationToken);
        return Result.From(items.Adapt<List<SysPosDto>>());
    }
}
